package com.ginmeta.domain.system.convert;

import com.ginmeta.domain.system.entity.SysUser;
import com.ginmeta.domain.system.vo.UserAddReqVO;
import com.ginmeta.domain.system.vo.UserEditIndividualReqVO;
import com.ginmeta.domain.system.vo.UserEditReqVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

/**
 * @author GinMeta
 */
@Mapper
public interface UserConvert {

    UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);

    @Mappings({
            @Mapping(target = "userId", ignore = true),
            @Mapping(target = "password", ignore = true),
            @Mapping(target = "status", ignore = true),
            @Mapping(target = "avatar", ignore = true),
            @Mapping(target = "registrationDate", ignore = true),
    })
    SysUser toSysUser(UserAddReqVO reqVO);

    @Mappings({
            @Mapping(target = "username", ignore = true),
            @Mapping(target = "password", ignore = true),
            @Mapping(target = "status", ignore = true),
            @Mapping(target = "avatar", ignore = true),
            @Mapping(target = "registrationDate", ignore = true),
    })
    SysUser toSysUser(UserEditReqVO reqVO);

    @Mappings({
            @Mapping(target = "username", ignore = true),
            @Mapping(target = "password", ignore = true),
            @Mapping(target = "status", ignore = true),
            @Mapping(target = "avatar", ignore = true),
            @Mapping(target = "registrationDate", ignore = true),
            @Mapping(target = "roleIds", ignore = true),
    })
    SysUser toSysUser(UserEditIndividualReqVO reqVO);
}
